package com.gxc.controller;

import com.gxc.dto.WiselyMessage;
import com.gxc.dto.WiselyResponse;
import org.springframework.messaging.handler.annotation.MessageMapping;
import org.springframework.messaging.handler.annotation.SendTo;
import org.springframework.stereotype.Controller;

/**
 * WebSocket Controller.
 *
 * @author 宫新程
 * @since 2019/2/14 14:56
 */
@Controller
public class WsController {

  @MessageMapping("/welcome")
  @SendTo("/topic/getResponse")
  public WiselyResponse say(WiselyMessage message) throws Exception {
    Thread.sleep(3000);
    return new WiselyResponse("Welcome, " + message.getName() + "!");
  }
}
